home *** CD-ROM | disk | FTP | other *** search
- /*
- File: ExpansionBus.h
-
- Contains: Expansion Mgr Device Tree Manipulation Routines
-
- */
-
- #ifndef __EXPANSIONBUS__
- #define __EXPANSIONBUS__
-
- #include <Types.h>
- #include <OSUtils.h> /* for sIntQElemPtr */
- #include <Devices.h>
-
- #define kTypeMask 0x03
- #define kDeviceNode 0x01
- #define kPropertyNode 0x02
-
- #define kNullAttribute 0
- #define kAttributeMask 0x70
- #define kAttributeLocked 0x10
- #define kAttributeNVRAM 0x20
- #define kAttributeSystem 0x40
-
- #define kAttributeROMProperty 0x80
- #define kAttributeDeferred 0x100
-
- /*
- * The device tree types
- */
-
- typedef void *DeviceTreeNodeID;
- typedef DeviceTreeNodeID DeviceNodeID;
- typedef DeviceTreeNodeID DevicePropertyID;
-
- /*
- * The device tree info structures
- */
-
- typedef struct DeviceNodeInfo {
- unsigned long nodeAttributes; // attributes of this node
- DeviceNodeID parentNode; // cannot be nil, except for the root
- DeviceNodeID peerNode; // nil if no peers
- DeviceNodeID childNode;
- DevicePropertyID propertyNode;
- char name[32]; // name of this node
- } DeviceNodeInfo;
-
- typedef struct DevicePropertyInfo {
- unsigned long nodeAttributes; // attributes of this node
- DeviceNodeID parentNode; // cannot be nil
- DevicePropertyID peerNode; // nil if no peers
- unsigned long propertySize; // size of property
- char name[32]; // name of this node
- } DevicePropertyInfo;
-
-
- /*
- * The driver services dispatch structure
- * used to call routines needed at interrupt time which may require nested
- * calls (ie. interrupt completion routines on bridges)
- *
- * The actual table dispatch is hidden behind a set of macros
- */
-
- #define kExpMgrDrvrSvcTblVersion 0x000a0001
-
- typedef struct ExpMgrDrvrSvcTbl {
- unsigned long version; // what services we support
- void (*EnableInt)(void);
- void (*DisableInt)(void);
- void (*DismissInt)(void);
- OSErr (*VBLDispatch)();
- Byte (*IORdByte)();
- unsigned short (*IORdWord)();
- unsigned long (*IORdLong)();
- OSErr (*IOWrByte)();
- OSErr (*IOWrWord)();
- OSErr (*IOWrLong)();
- } ExpMgrDrvrSvcTbl;
-
- #ifndef _ExpansionBusDispatch
- #define _ExpansionBusDispatch 0xAAF3
- #endif
-
- /*
- * Expansion Manager error codes - numbers will change
- *
- */
-
- enum {
- kLockedNode = -6000,
- kNotEnoughMemory = -6001,
- kInvalidNodeIDErr = -6002,
- kNodeNotFound = -6003,
- kNodeNotCreated = -6004,
- kDataTruncated = -6005,
- kInvalidName = -6006
- };
-
- /*
- * Expansion Manager C Interface
- *
- */
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- OSErr DeviceTreeRoot (DeviceNodeID *rootNode)
- = { 0x303c, 0x0204, _ExpansionBusDispatch};
-
- OSErr DeviceTreeDeviceInfo (DeviceNodeID nodeID, DeviceNodeInfo *nodeInfo)
- = { 0x303c, 0x0405, _ExpansionBusDispatch};
-
- OSErr DeviceTreePropertyInfo (DevicePropertyID nodeID, DevicePropertyInfo *nodeInfo)
- = { 0x303c, 0x0406, _ExpansionBusDispatch};
-
- OSErr DeviceTreePeerCount (DeviceNodeID nodeID, unsigned long *count)
- = { 0x303c, 0x040D, _ExpansionBusDispatch};
-
- OSErr DeviceTreePropertyCount (DeviceNodeID nodeID, unsigned long *count)
- = { 0x303c, 0x040E, _ExpansionBusDispatch};
-
- OSErr DeviceTreeSearch (DeviceNodeID *startNodeID, Byte *targetProperty,
- Byte *propertyValue, long *PropertySize, Boolean restartSearch)
- = { 0x303c, 0x0A07, _ExpansionBusDispatch};
-
- OSErr DeviceTreeNodeSearch (DeviceNodeID nodeID, Byte *targetProperty,
- DeviceNodeID *propertyNodeID,
- Byte *propertyData, unsigned long maxSize,
- unsigned long *actualSize)
- = { 0x303c, 0x0C08, _ExpansionBusDispatch};
-
- OSErr DeviceTreeAddDevice (DeviceNodeID parentNodeID, unsigned long attributes,
- Byte *name, DeviceNodeID *newNode)
- = { 0x303c, 0x0809, _ExpansionBusDispatch};
-
- OSErr DeviceTreeDeleteDevice (DeviceNodeID nodeID)
- = { 0x303c, 0x020A, _ExpansionBusDispatch};
-
- OSErr DeviceTreeAddProperty (DeviceNodeID parentNodeID, unsigned long attributes,
- Byte *name, DevicePropertyID *newNode)
- = { 0x303c, 0x080B, _ExpansionBusDispatch};
-
- OSErr DeviceTreeDeleteProperty (DevicePropertyID nodeID)
- = { 0x303c, 0x020C, _ExpansionBusDispatch};
-
- OSErr DeviceTreeSetProperty (DevicePropertyID nodeID, Byte *userData,
- unsigned long size)
- = { 0x303c, 0x060F, _ExpansionBusDispatch};
-
- OSErr DeviceTreeGetProperty (DevicePropertyID nodeID, Byte *userData,
- unsigned long size)
- = { 0x303c, 0x0610, _ExpansionBusDispatch};
-
- OSErr ExpMgrRegisterBridge (DeviceNodeID nodeID)
- = { 0x303c, 0x0211, _ExpansionBusDispatch};
-
- OSErr ExpMgrEnableBridge (DeviceNodeID nodeID)
- = { 0x303c, 0x0212, _ExpansionBusDispatch};
-
- OSErr ExpMgrDisableBridge (DeviceNodeID nodeID)
- = { 0x303c, 0x0213, _ExpansionBusDispatch};
-
- OSErr ExpMgrInstallISR (QElemPtr sIntQElemPtr, DeviceNodeID nodeID)
- = { 0x303c, 0x0400, _ExpansionBusDispatch};
-
- OSErr ExpMgrRemoveISR (QElemPtr sIntQElemPtr, DeviceNodeID nodeID)
- = { 0x303c, 0x0401, _ExpansionBusDispatch};
-
- OSErr ExpMgrInstallVBL (QElemPtr sIntQElemPtr, DeviceNodeID nodeID)
- = { 0x303c, 0x0402, _ExpansionBusDispatch};
-
- OSErr ExpMgrRemoveVBL (QElemPtr sIntQElemPtr, DeviceNodeID nodeID)
- = { 0x303c, 0x0403, _ExpansionBusDispatch};
-
- void AddExpansionDriver (Boolean searchROMMap)
- = { 0x303c, 0x0214, _ExpansionBusDispatch};
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif